<template>
	<div class="order-details" v-if="show">
		<head-back-title title="订单--订单详情"></head-back-title>
		<el-card>
			<div class="order-content">
				<p class="order-title">订单详情</p>
				<div class="order-info">
					<p class="order-info-title">订单信息</p>
					<div class="order-info-content">
						<el-row :gutter="20">
							<el-col :span="4">订单编号：{{ orderInfo.order_sn }}</el-col>
							<el-col :span="4">订单id：{{ orderInfo.order_id }}</el-col>
							<el-col :span="4">下单时间：{{ orderInfo.add_time }}</el-col>
							<el-col :span="4" v-if="admin_id != 3">客户名字：{{ orderInfo.address_id.consignee }}</el-col>
							<el-col :span="4" v-if="admin_id != 3">客户电话：{{ orderInfo.address_id.mobile }}</el-col>
						</el-row>
						<el-row :gutter="20">
							<el-col :span="4" v-if="admin_id != 3">订单总价：{{ orderInfo.order_amount }}</el-col>
							<el-col :span="4">订单状态：{{ orderInfo.status_name }}</el-col>
							<el-col :span="4">初始订单金额：{{ orderInfo.initial_order_amount }}</el-col>
							<el-col :span="4" v-if="admin_id != 3">订单金额：{{ orderInfo.order_amount }}</el-col>
							<el-col :span="4" v-if="admin_id != 3">佣金额：{{ orderInfo.platform_commission }}</el-col>
							<el-col :span="4" v-if="admin_id != 3">手续费：{{ orderInfo.pay_charge }}</el-col>
							<el-col :span="4">支付方式：{{ orderInfo.pay_type }}</el-col>
							<el-col :span="2" v-if="admin_id != 3 && orderInfo.is_insure == 1">易碎险：￥{{ orderInfo.insure_price
								}}</el-col>
							<el-col :span="10" v-if="admin_id != 3">
								客户地址：{{ orderInfo.address_id.province }}{{ orderInfo.address_id.city }}{{ orderInfo.address_id.district
								}}{{ orderInfo.address_id.address }}
							</el-col>
						</el-row>
						<el-row :gutter="20" v-if="admin_id != 3">
							<el-col :span="4" v-if="orderInfo.coupon_info != null">优惠券金额：{{ orderInfo.coupon_info.money }}</el-col>
							<el-col :span="4">尾款：{{ orderInfo.tail_amount }}</el-col>
							<el-col :span="4">签约：{{ orderInfo.introduce_user }}</el-col>
							<el-col :span="4">运营：{{ orderInfo.follow_user }}</el-col>
						</el-row>
						<el-row :gutter="20">
							<el-col :span="4" v-if="admin_type == 1">财务备注：{{ orderInfo.platform_remark }}</el-col>
							<el-col :span="4">用户备注：{{ orderInfo.brief }}</el-col>
							<el-col :span="4" v-if="orderInfo.type == 1">订单类型：普通订单</el-col>
							<el-col :span="4" v-if="orderInfo.type == 2">订单类型：进货订单</el-col>
							<el-col :span="4" v-if="admin_type == 1">推荐人名字：{{ orderInfo.parent_nickname }}</el-col>
							<el-col :span="4" v-if="admin_type == 1">推荐人ID：{{ orderInfo.parent_id }}</el-col>
						</el-row>
						<el-row :gutter="20">
							<el-col :span="4">用户ID：{{ orderInfo.user_id }}</el-col>
							<el-col :span="4">店铺名称:{{ orderInfo.store_name }}</el-col>
							<el-col :span="4">店铺ID:{{ orderInfo.store_id }}</el-col>
							<!-- <el-col :span="4">店铺类型:{{ orderInfo.store_type }}</el-col> -->
							<el-col :span="8" v-if="admin_type == 1">
								服务类型：
								<el-select style="width: 120px;" size="mini" v-model="orderInfo.is_install" placeholder="请选择"
									@change="selectInstall">
									<el-option v-for="item in serverOptions" :key="item.label" :label="item.label"
										:value="item.label"></el-option>
								</el-select>
							</el-col>
							<!-- <el-col :span="4" v-if="orderInfo.store_type==1">费用选择：{{ orderInfo.express_type }}</el-col> -->
							<!-- <el-col :span="24" v-if="orderInfo.store_type==1">物流说明：{{ orderInfo.express_brief }}</el-col> -->
						</el-row>
					</div>
				</div>
				<div class="shipping-info" v-if="orderInfo.shippingInfo && (admin_id != 3 || admin_id == 3 && orderInfo.notice_time)">
					<p class="order-info-title">厂家发货信息</p>
					<div class="order-info-content">
						<el-row :gutter="20">
							<el-col :span="3">收件人：{{ orderInfo.shippingInfo.consignee }}</el-col>
							<el-col :span="4">收件电话：{{ orderInfo.shippingInfo.mobile }}</el-col>
							<el-col :span="10">
								收件地址：{{ orderInfo.shippingInfo.province }}{{ orderInfo.shippingInfo.city }}{{
									orderInfo.shippingInfo.district
								}}{{ orderInfo.shippingInfo.address }}
							</el-col>
							<!-- <el-col :span="4">物流付费：货到付款</el-col> -->
						</el-row>
					</div>
				</div>
				<!-- <div class="logistics-info">
					<p class="order-info-title">物流点信息</p>
					<el-button v-if="admin_id == 13 || admin_id == 8 || admin_id == 12 || admin_id == 9" type="primary"
						size="mini" @click="editLogisticsPoint">更改物流点信息</el-button>
					<div class="order-info-content" v-if="orderInfo.order_logistics">
						<el-row :gutter="20">
							<el-col :span="4">物流公司名称：{{ orderInfo.order_logistics.company_name }}</el-col>
							<el-col :span="4">开始物流点联系电话：{{ orderInfo.order_logistics.start_mobile }}</el-col>
							<el-col :span="4">开始物流点座机号：{{ orderInfo.order_logistics.start_landline }}</el-col>
							<el-col :span="10">
								开始物流点地址：{{ orderInfo.order_logistics.start_province }}{{ orderInfo.order_logistics.start_city }}{{
									orderInfo.order_logistics.start_district
								}}{{ orderInfo.order_logistics.start_address }}
							</el-col>
						</el-row>
						<el-row :gutter="20">
							<el-col :span="4">结束物流联系人：{{ orderInfo.order_logistics.end_consignee }}</el-col>
							<el-col :span="4">结束物流点联系方式：{{ orderInfo.order_logistics.end_mobile }}</el-col>
							<el-col :span="4">结束物流点座机号：{{ orderInfo.order_logistics.end_landline }}</el-col>
							<el-col :span="10">
								结束物流点地址：{{ orderInfo.order_logistics.end_province }}{{ orderInfo.order_logistics.end_city }}{{
									orderInfo.order_logistics.end_district
								}}{{ orderInfo.order_logistics.end_address }}
							</el-col>
						</el-row>
					</div>
				</div> -->
				<div class="logistics-info" v-if="(orderInfo.factory_move==1 || orderInfo.factory_move==3) && orderInfo.order_logistics && (admin_id != 3 || admin_id == 3 && orderInfo.notice_time)">
					<p class="order-info-title">物流方向</p>
					<div class="order-info-content">
						<el-row :gutter="20">
							<el-col :span="4">物流类型：{{ orderInfo.factory_move==1?'客户物流':'平台物流' }}</el-col>
							<el-col :span="4">物流名称：{{ orderInfo.order_logistics.company_name }}</el-col>
							<el-col :span="4">联系人：{{ orderInfo.order_logistics.consignee }}</el-col>
							<el-col :span="4">联系电话：{{ orderInfo.order_logistics.mobile }}</el-col>
							<el-col :span="24">物流地址：{{ orderInfo.order_logistics.province }}{{ orderInfo.order_logistics.city }}{{ orderInfo.order_logistics.area }}{{ orderInfo.order_logistics.address }}</el-col>
						</el-row>
					</div>
				</div>
				<div class="logistics-info" v-if="orderInfo.express_img.length > 0">
					<p class="order-info-title">物流单</p>
					<div class="order-info-content">
						<div class="logistics-img" v-for="(item, index) in orderInfo.express_img" :key="index">
							<el-image :src="item" :preview-src-list="orderInfo.express_img"
								style="width: 50px; height: 50px; vertical-align: top;">
							</el-image>
							<i class="el-icon-error del" @click="onDelImg(index)" v-if="admin_id == 1 || admin_id == 7"></i>
						</div>
					</div>
				</div>
				<!-- 厂家分账打款-->
				<!-- <template>
					<div class="product-info" v-if="admin_id == 1 || admin_id == 4 || admin_id == 13">
						<p class="order-info-title">厂家分账打款 
							<el-button type="primary" size="mini" v-if="admin_id == 1 || admin_id == 13" @click="onSplitAccount">厂家分账</el-button>
						</p>
						<div class="order-info-content">
						</div>
					</div>
					<div class="goods-list table-theme" v-if="admin_id == 1 || admin_id == 4 || admin_id == 13">
						<el-table :data="list" stripe>
							<el-table-column
							label="序号"
							align="center"
							prop="order_id"
							></el-table-column>
							<el-table-column
							label="工厂名字"
							align="center"
							prop="factory_name"
							></el-table-column>
							<el-table-column
							label="工厂编号"
							align="center"
							prop="factory_sn"
							></el-table-column>
							<el-table-column
							label="订单编号"
							align="center"
							prop="order_sn"
							></el-table-column>
							<el-table-column label="结算类型" align="center">
							<template slot-scope="scope">
								<span>{{
								scope.row.pay_type == 1
									? "预付款"
									: scope.row.pay_type == 2
									? "全款"
									: "月结"
								}}</span>
							</template>
</el-table-column>
<el-table-column label="支付编号" align="center" prop="random_char"> </el-table-column>
<el-table-column label="付款占比" align="center" prop="advance_charge"></el-table-column>
<el-table-column label="付款类型" align="center">
	<template slot-scope="scope">
								<span>{{ scope.row.type == 1 ? "预付款" : "尾款" }}</span>
							</template>
</el-table-column>
<el-table-column label="收款账户名" align="center" prop="bank_account_name"></el-table-column>
<el-table-column label="开户行" align="center" prop="bank_deposit"></el-table-column>
<el-table-column label="结算金额" align="center" prop="money">
</el-table-column>
<el-table-column label="总收款" align="center" prop="total_money"></el-table-column>
<el-table-column label="支付状态" align="center">
	<template slot-scope="scope">
									<span>{{
									scope.row.pay_status == 0
										? "未支付"
										: scope.row.pay_status == 1
										? "支付成功"
										: scope.row.pay_status == 2
										? "支付失败"
										:""
									}}</span>
								</template>
</el-table-column>
<el-table-column label="状态" align="center">
	<template slot-scope="scope">
								<span>{{
								scope.row.status == 1
									? "待审核"
									: scope.row.status == 2
									? "提交审核"
									: scope.row.status == 3
									? "通过"
									: scope.row.status == 4
									? "拒绝"
									: ""
								}}</span>
							</template>
</el-table-column>
<el-table-column label="支付时间" align="center" prop="up_time"></el-table-column>
<el-table-column label="时间" align="center" prop="add_time"></el-table-column>
<el-table-column label="操作" align="center" width="180">
	<template slot-scope="scope" align="center">
								<el-button
								class="margin-top6px"
								type="primary"
								size="mini"
								v-if="scope.row.status < 2"
								@click="onUpType(scope.row.factory_pay_id)"
								>发起申请</el-button
								>
								<el-button
								class="margin-top6px"
								type="primary"
								size="mini"
								v-else	
								@click="onOpenPage(scope.row.order_id)"
								>查看</el-button
								>
								<el-button class="margin-top6px" type="primary" size="mini" @click="onOpenMoney(scope.row.factory_pay_id)" v-if="scope.row.status < 2 && user_id == 18">改价</el-button>
							</template>
</el-table-column>
</el-table>
</div>
</template> -->
				<!-- 商家转账 -->
				<template v-if="admin_id == 2 || admin_id == 16">
					<div class="product-info">
						<p class="order-info-title">转账信息</p>
					</div>
					<div class="goods-list table-theme">
						<el-table :data="useMoneyDetailList" stripe>
							<el-table-column label="序号" align="center" prop="user_money_detail_id"></el-table-column>
							<el-table-column label="用户编号" align="center" prop="user_id"></el-table-column>
							<el-table-column label="金额" align="center" prop="money"></el-table-column>
							<el-table-column label="备注" align="center" prop="brieft"></el-table-column>
							<el-table-column label="是否转账" align="center" prop="is_trans">
								<template slot-scope="scope">
									{{ scope.row.is_trans == 0 ? '否' : '是' }}
								</template>
							</el-table-column>
							<el-table-column label="日期" align="center" prop="add_time"></el-table-column>
							<el-table-column label="操作" align="center">
								<template slot-scope="scope">
									<el-button type="primary" size="mini" v-if="scope.row.is_trans == 0"
										@click="onChangeUseMoneyDetailConfirm(scope.row.user_money_detail_id)">确认转账</el-button>
								</template>
							</el-table-column>
						</el-table>
					</div>
				</template>
				<!-- 下单产品更换记录 -->
				<template v-if="orderInfo.change_log.length">
					<div class="product-info">
						<p class="order-info-title">下单产品更换记录</p>
					</div>
					<div class="goods-list table-theme">
						<el-table :data="orderInfo.change_log" stripe>
							<el-table-column label="序号" align="center" prop="rec_id"></el-table-column>
							<el-table-column label="更换前商品编号" align="center" min-width="120" prop="old_goods_sn"></el-table-column>
							<el-table-column label="更换后商品编号" align="center" min-width="120" prop="goods_sn"></el-table-column>
							<el-table-column label="更换前商品名称" align="center" min-width="120" prop="old_goods_name"></el-table-column>
							<el-table-column label="更换后商品名称" align="center" min-width="120" prop="goods_name"></el-table-column>
							<el-table-column label="更换前数量" align="center" min-width="100" prop="old_goods_number"></el-table-column>
							<el-table-column label="更换后数量" align="center" min-width="100" prop="goods_number"></el-table-column>
							<el-table-column label="工厂价" align="center" prop="factory_price"></el-table-column>
							<el-table-column label="拿货价" align="center" prop="self_price"></el-table-column>
							<el-table-column label="零售价" align="center" prop="goods_price"></el-table-column>
							<el-table-column label="图片" align="center">
								<template slot-scope="scope">
									<el-image :src="scope.row.img" style="width: 60px; height: 60px;"></el-image>
								</template>
							</el-table-column>
							<el-table-column label="颜色" align="center" prop="color"></el-table-column>
							<el-table-column label="材质" align="center" prop="lining"></el-table-column>
							<el-table-column label="尺寸" align="center" prop="size"></el-table-column>
							<el-table-column label="商品备注" align="center" prop="brief"></el-table-column>
							<el-table-column label="后台备注" align="center" prop="inside_remark"></el-table-column>
							<el-table-column label="包件数" align="center" prop="goods_pack"></el-table-column>
							<el-table-column label="操作员" align="center" prop="create_by"></el-table-column>
							<el-table-column label="更改凭证" align="center" min-width="350">
								<template slot-scope="scope">
									<template v-if="scope.row.change_voucher.length">
										<el-image :src="data" v-for="(data, index) in scope.row.change_voucher" :key="index"
											style="width: 60px; height: 60px; margin: 0 5px;"
											:preview-src-list="scope.row.change_voucher"></el-image>
									</template>
								</template>
							</el-table-column>
							<el-table-column label="更改说明" align="center" min-width="200" prop="change_brief"></el-table-column>
							<el-table-column label="更改时间" align="center" prop="add_time" min-width="165"></el-table-column>
							<el-table-column label="操作" align="center" fixed="right">
								<template slot-scope="scope">
									<el-button type="primary" size="mini" @click="goodsDetails(scope.row.old_goods_id)">详情</el-button>
								</template>
							</el-table-column>
						</el-table>
					</div>
				</template>
				<!-- 改价记录 -->
				<template v-if="orderInfo.price_log.length">
					<div class="product-info">
						<p class="order-info-title">改价记录</p>
					</div>
					<div class="goods-list table-theme">
						<el-table :data="orderInfo.price_log" stripe>
							<el-table-column label="序号" align="center" prop="id"></el-table-column>
							<el-table-column label="类型" align="center" prop="type_name"></el-table-column>
							<el-table-column label="工厂编号" align="center" prop="factory_sn"></el-table-column>
							<el-table-column label="工厂名称" align="center" prop="factory_name"></el-table-column>
							<el-table-column label="商品编号" align="center" prop="goods_sn"></el-table-column>
							<el-table-column label="商品名称" align="center" prop="goods_name"></el-table-column>
							<el-table-column label="商品规格" align="center">
								<template slot-scope="scope">
									{{ scope.row.color }}、{{ scope.row.lining }}、{{ scope.row.size }}
								</template>
							</el-table-column>
							<el-table-column label="原价格" align="center" prop="original_goods_price"></el-table-column>
							<el-table-column label="修改价" align="center" prop="goods_price"></el-table-column>
							<el-table-column label="修改说明" align="center" prop="brief"></el-table-column>
							<el-table-column label="修改凭证" align="center" min-width="350">
								<template slot-scope="scope">
									<template v-if="scope.row.voucher_img.length">
										<el-image :src="data" v-for="(data, index) in scope.row.voucher_img" :key="index"
											style="width: 60px; height: 60px; margin: 0 5px;"
											:preview-src-list="scope.row.voucher_img"></el-image>
									</template>
								</template>
							</el-table-column>
							<el-table-column label="修改时间" align="center" prop="add_time"></el-table-column>
							<el-table-column label="操作员" align="center" prop="create_by"></el-table-column>
							<el-table-column label="操作" align="center" fixed="right">
								<template slot-scope="scope">
									<el-button type="primary" size="mini" @click="goodsDetails(scope.row.goods_id)">详情</el-button>
								</template>
							</el-table-column>
						</el-table>
					</div>
				</template>
				<div class="product-info">
					<p class="order-info-title">
						订单信息
						<!-- <el-button type="primary" size="mini" v-if="admin_id == 3" @click="onAllPrinting">打印唛头</el-button> -->
					</p>
					<div class="order-info-content"></div>
				</div>
				<div class="goods-list table-theme">
					<el-table :data="goodsList" ref="goodsTable" stripe @selection-change="handleSelectionChange"
						@row-click="handleRowClick">
						<el-table-column type="selection" width="55"></el-table-column>
						<el-table-column label="序号" align="center" prop="rec_id" width="60"></el-table-column>
						<el-table-column label="商品ID" align="center" prop="goods_id" width="60"></el-table-column>
						<el-table-column label="类别" align="center" prop="group_text" width="50"
							v-if="admin_id == 1 || admin_id == 2"></el-table-column>
						<el-table-column label="工厂编号" align="center" prop="factory_sn"></el-table-column>
						<el-table-column label="工厂名称" align="center" prop="factory_name"></el-table-column>
						<el-table-column label="商品编号" align="center" prop="goods_sn"></el-table-column>
						<el-table-column label="sku编号" align="center" prop="sku_sn"></el-table-column>
						<el-table-column label="工厂货号" align="center" prop="lining_sn"></el-table-column>
						<el-table-column label="名称" align="center" prop="goods_name"></el-table-column>
						<el-table-column label="数量" align="center" width="60" v-if="admin_type == 1">
							<template slot-scope="scope">
								<el-input v-model.number="scope.row.goods_number" @blur="onSetOrdefNumber(scope.row)"
									placeholder="请输入数量"></el-input>
							</template>
						</el-table-column>
						<el-table-column label="数量" align="center" width="50" v-else prop="goods_number"></el-table-column>
						<el-table-column label="工厂价" align="center" prop="goods_factory_price"
							v-if="admin_id == 1 || admin_id == 3 || admin_id == 6 || admin_id == 4"></el-table-column>
						<el-table-column label="拿货价" align="center" prop="goods_self_price"
							v-if="(admin_type == 1 || admin_id == 7) || admin_type == 2"></el-table-column>
						<el-table-column label="零售价" align="center" prop="goods_price"
							v-if="admin_type == 2 || (admin_type == 1 && admin_id != 7)"></el-table-column>
						<el-table-column label="图片" align="center" width="80">
							<template slot-scope="scope">
								<ImgPopover :src="scope.row.img"></ImgPopover>
							</template>
						</el-table-column>
						<el-table-column label="颜色" align="center" prop="color"></el-table-column>
						<el-table-column label="材质" align="center" prop="lining"></el-table-column>
						<el-table-column label="尺寸" align="center" prop="size"></el-table-column>
						<el-table-column label="商品备注" align="center" prop="brief">
							<template slot-scope="scope">
								<div :style="{ backgroundColor: admin_id == 7 ? '#F56C6C' : '', color: admin_id == 7 ? '#fff' : '' }">
									{{ scope.row.brief }}</div>
							</template>
						</el-table-column>
						<el-table-column width="100" label="后台备注" align="center" prop="inside_remark"
							v-if="admin_id == 13 || admin_id == 1"></el-table-column>
						<el-table-column label="工厂地址" align="center" prop="factory_address" width="70"
							v-if="admin_id == 8 || admin_id == 12"></el-table-column>
						<el-table-column label="预计发货时间" align="center" prop="estimate_time"
							v-if="admin_type == 1"></el-table-column>
						<el-table-column label="预计发货时间" align="center" prop="user_estimate_time"
							v-if="admin_type != 1"></el-table-column>
						<el-table-column label="包件数" align="center" prop="goods_pack" v-if="admin_id == 3 || admin_type == 1"
							width="140">
							<template slot-scope="scope">
								<el-tooltip class="item" effect="dark" content="点击修改包件数" placement="bottom">
									<div class="sort-input-view"
										@click.stop="setPack(scope.$index, scope.row.order_id, scope.row.goods_pack, scope.row.rec_id)">
										<el-input v-if="goodsIndex == scope.$index" v-model="infoForm.goods_pack" placeholder=""
											type="number" onKeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))">
											<el-button slot="append" icon="el-icon-check" @click.stop="postPack(0)"></el-button>
											<el-button slot="append" icon="el-icon-close" @click.stop="postPack(1)"></el-button>
										</el-input>
										<span v-else>{{ scope.row.goods_pack }}</span>
									</div>
								</el-tooltip>
							</template>
						</el-table-column>
						<el-table-column label="体积" align="center" width="160">
							<template slot-scope="scope">
								<el-tooltip class="item" effect="dark" content="点击修改体积" placement="bottom">
									<div class="sort-input-view"
										@click.stop="setBulk(scope.$index, scope.row.order_id, scope.row.goods_bulk, scope.row.rec_id)">
										<el-input v-if="goodsBulkIndex == scope.$index" v-model="bulkForm.goods_bulk" placeholder="">
											<el-button slot="append" icon="el-icon-check" @click.stop="postBulk(0)"></el-button>
											<el-button slot="append" icon="el-icon-close" @click.stop="postBulk(1)"></el-button>
										</el-input>
										<span v-else>{{ scope.row.goods_bulk }}m³</span>
									</div>
								</el-tooltip>
							</template>
						</el-table-column>
						<el-table-column label="区域" align="center" prop="region_name"></el-table-column>
						<el-table-column label="售后" align="center" prop="afterSale_text"
							v-if="admin_id == 1 || admin_id == 2"></el-table-column>
						<!-- <el-table-column label="签收单" align="center" width="80" v-if="admin_id != 2">
							<template slot-scope="scope">
								<ImgPopover :src="scope.row.logistics_img"></ImgPopover>
							</template>
						</el-table-column> -->
						<el-table-column label="物流凭证" align="center" min-width="350">
							<template slot-scope="scope">
								<template v-if="scope.row.express_img.length">
									<el-image :src="data" v-for="(data, index) in scope.row.express_img" :key="index"
										style="width: 60px; height: 60px; margin: 0 5px;"
										:preview-src-list="scope.row.express_img"></el-image>
								</template>
							</template>
						</el-table-column>
						<el-table-column label="物流单号" align="center" prop="express_sn"></el-table-column>
						<el-table-column label="发货时间" align="center" prop="express_time"></el-table-column>
						<el-table-column width="60" label="入仓时间" align="center" prop="warehouse_time"
							v-if="admin_type == 1"></el-table-column>
						<el-table-column fixed="right" label="状态" align="center" prop="status_text" width="100"></el-table-column>
						<el-table-column label="生产状态" align="center" width="100" fixed="right">
							<template slot-scope="scope">
								<el-tag type="danger" v-if="scope.row.produce_status == 0">{{ scope.row.produce_status_name }}</el-tag>
								<el-tag type="success" v-if="scope.row.produce_status == 1">{{ scope.row.produce_status_name }}</el-tag>
							</template>
						</el-table-column>
						<el-table-column width="80" label="是否入仓" fixed="right" align="center" prop="warehouse_text"
							v-if="admin_type == 1 || admin_id == 2"></el-table-column>
						<el-table-column width="80" label="是否定制" fixed="right" align="center">
							<template slot-scope="scope">
								<el-switch v-model="scope.row.is_customized"
									:disabled="scope.row.status != 4 && scope.row.status != 5 && scope.row.is_customized == 0 ? false : true"
									:active-value="1" :inactive-value="0" @change="customChange($event, scope.row)">
								</el-switch>
							</template>
						</el-table-column>
						<el-table-column fixed="right" label="操作" align="center" width="180"
							v-if="admin_type == 1 || admin_id == 2 || admin_id == 7 || admin_id == 3">
							<template slot-scope="scope">
								<div class="operate">
									<el-button class="margin-top6px" type="primary" size="mini" @click.stop="modifyTime(scope.row.rec_id)"
										v-if="admin_type == 1 || admin_id == 3">
										修改发货时间
									</el-button>
									<el-button class="margin-top6px" type="primary" size="mini"
										@click.stop="setBrief(scope.row.rec_id, scope.row.brief)"
										v-if="(admin_type == 1 && admin_id != 7) || admin_id == 2">
										备注
									</el-button>
									<el-button class="margin-top6px" type="danger" size="mini"
										@click.stop="warehouse(scope.row.rec_id, scope.row.goods_bulk, scope.row.goods_pack, scope.row.region_id)"
										v-if="(admin_id == 7 && scope.row.is_warehouse == 0) ||
											(admin_id == 13 && scope.row.is_warehouse == 0) ||
											(admin_id == 8 && scope.row.is_warehouse == 0)">
										入仓
									</el-button>
									<el-button class="margin-top6px" type="primary" size="mini"
										@click.stop="warehouse(scope.row.rec_id, scope.row.goods_bulk, scope.row.goods_pack, scope.row.region_id)"
										v-if="(admin_id == 7 && scope.row.is_warehouse == 1) ||
											(admin_id == 13 && scope.row.is_warehouse == 1) ||
											(admin_id == 8 && scope.row.is_warehouse == 1)">
										入仓
									</el-button>
									<el-button class="margin-top6px" type="primary" size="mini"
										@click.stop="onGoWarehouse(scope.row.rec_id)"
										v-if="admin_id == 7 || admin_id == 13 || admin_id == 8">
										出仓
									</el-button>
									<el-button class="margin-top6px" type="primary" size="mini"
										@click.stop="onRevocationWarehouse(scope.row.rec_id)" v-if="
											(admin_id == 7 && scope.row.is_warehouse > 0) ||
											(admin_id == 13 && scope.row.is_warehouse > 0) ||
											(admin_id == 8 && scope.row.is_warehouse > 0)
										">
										撤回入仓
									</el-button>
									<el-button class="margin-top6px" type="primary" size="mini"
										@click.stop="onMoveWarehouse(scope.row.rec_id, scope.row.region_id)"
										v-if="admin_id == 7 || admin_id == 13 || admin_id == 8">
										移区
									</el-button>
									<el-button class="margin-top6px" type="primary" size="mini"
										@click.stop="goodsDetails(scope.row.goods_id)" v-if="admin_type == 1 && admin_id != 7">
										详情
									</el-button>
									<el-button class="margin-top6px" type="primary" size="mini" @click.stop="printing(scope.row)"
										v-if="admin_id == 3 || admin_id == 7 || admin_id == 13">
										打印唛头
									</el-button>
									<el-button class="margin-top6px" type="primary" size="mini" @click.stop="priceChange(scope.row)"
										v-if="scope.row.status == 0 && (admin_id == 8 || admin_id == 1 || admin_id == 4 || admin_id == 9)">订单改价</el-button>
									<el-button class="margin-top6px" type="primary" size="mini"
										@click.stop="factoryChange(scope.row.rec_id)" v-if="user_id == 18">工厂改价</el-button>
									<el-button class="margin-top6px" type="primary" size="mini"
										@click.stop="addAfterSale(scope.row.rec_id)"
										v-if="orderInfo.order_status == 1 && orderInfo.shipping_status == 2 && orderInfo.pay_status == 2">
										添加售后
									</el-button>
									<el-button class="margin-top6px" type="primary" size="mini" @click.stop="onAfterRemark(scope.row)"
										v-if="admin_id == 13 || admin_id == 1">
										后台备注
									</el-button>
									<el-button class="margin-top6px" type="primary" size="mini"
										v-if="scope.row.status != 4 && scope.row.status != 5"
										@click.stop="OrderGoodsCancel(scope.row)">取消</el-button>
									<!-- <el-button class="margin-top6px" type="primary" size="mini" v-if="!scope.row.factory_id"
										@click.stop="assign(scope.row)">指派工厂</el-button>
									<el-button class="margin-top6px" type="primary" size="mini"
										v-if="scope.row.status != 4 && scope.row.status != 5 && scope.row.is_customized == 0"
										@click="changeGoods(scope.row)">更换产品</el-button> -->
									<el-button class="margin-top6px" type="primary" size="mini" v-if="scope.row.status == 4 && admin_id!=3"
										@click.stop="ConfirmReceipt(scope.row.order_id)">确认收货</el-button>
									<el-button class="margin-top6px" type="primary" size="mini" v-if="scope.row.is_frozen == 0"
										@click.stop="ExtendFrozen(scope.row)">延长冻结</el-button>
								</div>
							</template>
						</el-table-column>
					</el-table>
				</div>
				<div class="button-group">
					<el-button type="primary" size="medium" @click="notifyShip()" v-if="shippingList.length && admin_id!=3">通知发货</el-button>
					<el-button type="primary" size="medium" @click="produceComplate()" v-if="shippingList.length && admin_id==3 && orderInfo.factory_waite_status==1">生产完成</el-button>
					<el-button size="medium" @click="onBatchWarehouse"
						v-if="admin_id == 7 || admin_id == 13 || admin_id == 8">批量移区</el-button>
					<el-button size="medium" @click="delivery"
						v-if="(admin_id == 3 || admin_id == 7 || admin_id == 13) && orderInfo.notice_time && orderInfo.factory_waite_status==1">批量发货</el-button>
					<el-button size="medium" @click="goBack">返回</el-button>
				</div>
			</div>
		</el-card>

		<!-- 通知发货弹框 -->
		<el-dialog title="通知发货" :visible.sync="notifyShipDialog" center :modal-append-to-body="false" width="480px">
			<el-form :model="notifyShipForm" ref="notifyShipForm" label-width="120px">
				<div class="remarks-info">
					<el-form-item label="发货时间:" prop="notice_time">
						<el-date-picker style="width: 100%;" v-model="notifyShipForm.notice_time" type="date" placeholder="选择发货日期" value-format="yyyy-MM-dd"></el-date-picker>
					</el-form-item>
				</div>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click="notifyShipDialog = false">取 消</el-button>
				<el-button type="primary" @click="confirmNotifyShip">确 定</el-button>
			</span>
		</el-dialog>

		<!-- 仓库上传物流弹框 和 工厂上传物流发货到客户的弹框 -->
		<el-dialog title="发货" :visible.sync="logisticsDialog" center :modal-append-to-body="false" width="680px">
			<el-form :model="logisticsForm" :rules="logisticsFormRules" ref="logisticsForm" label-width="120px">
				<div class="logistics-info">
					<el-form-item label="上传物流单号:" class="upload-box" prop="img">
						<div class="goods-img-upload">
							<div class="goods-img-upload-btns">
								<el-upload :file-list="imageUrl" ref="upload" action="fakeaction" :show-file-list="false"
									:http-request="function (res) { return upload(0, res); }" multiple accept="image/*"> <el-button
										type="primary" size="small">上传图片</el-button>
								</el-upload>
								<el-button type="danger" size="small" @click="reset()">重置</el-button>
							</div>
							<div class="goods-img-upload-imgs">
								<el-image v-if="!imageUrl.length">
									<div slot="error"></div>
								</el-image>
								<div v-for="(data, index) in imageUrl" :key="index" class="vice_big_box" v-else>
									<i class="el-icon-error" @click="delVice(index)"></i>
									<el-image :preview-src-list="imageUrlShow" :src="data.image" fit="contain"></el-image>
								</div>
							</div>
						</div>
					</el-form-item>
					<div class="info-exhibition">
						<el-form-item label="物流公司:" prop="expressCompany">
							<el-input v-model="logisticsForm.expressCompany" placeholder="请输入物流公司" clearable></el-input>
						</el-form-item>
						<el-form-item label="物流单号:" prop="express_sn">
							<el-input v-model="logisticsForm.express_sn" placeholder="请输入物流单号" clearable></el-input>
						</el-form-item>
						<el-form-item v-if="admin_id != 3" label="备注:" prop="express_remark">
							<el-input v-model="logisticsForm.express_remark" placeholder="请输入备注"></el-input>
						</el-form-item>
					</div>
				</div>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click="logisticsDialog = false">取 消</el-button>
				<el-button type="primary" @click="confirmClick(0, 'logisticsForm')">确 定</el-button>
			</span>
		</el-dialog>

		<!-- 工厂上传物流弹框 发货到平台的-->
		<el-dialog title="发货" :visible.sync="factoryDialog" center :modal-append-to-body="false" width="680px">
			<el-form :model="factoryForm" :rules="factoryFormRules" ref="factoryForm" label-width="120px">
				<div class="logistics-info">
					<el-form-item label="上传物流单号:" class="upload-box" prop="logistics_img">
						<div class="goods-img-upload">
							<div class="goods-img-upload-btns">
								<el-upload :file-list="imageUrl" ref="upload" action="fakeaction" :show-file-list="false"
									:http-request="function (res) { return upload(0, res); }" multiple accept="image/*"> <el-button
										type="primary" size="small">上传图片</el-button>
								</el-upload>
								<el-button type="danger" size="small" @click="reset()">重置</el-button>
							</div>
							<div class="goods-img-upload-imgs">
								<el-image v-if="!imageUrl.length">
									<div slot="error"></div>
								</el-image>
								<div v-for="(data, index) in imageUrl" :key="index" class="vice_big_box" v-else>
									<i class="el-icon-error" @click="delVice(index)"></i>
									<el-image :preview-src-list="imageUrlShow" :src="data.image" fit="contain"></el-image>
								</div>
							</div>
						</div>
					</el-form-item>
				</div>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click="factoryDialog = false">取 消</el-button>
				<el-button type="primary" @click="confirmClick(1, 'factoryForm')">确 定</el-button>
			</span>
		</el-dialog>

		<!-- 商品备注弹框 -->
		<el-dialog title="备注" :visible.sync="remarksDialog" center :modal-append-to-body="false" width="680px">
			<el-form :model="remarksForm" :rules="remarksFormRules" ref="remarksForm" label-width="120px">
				<div class="remarks-info">
					<el-form-item label="备注:" prop="brief"><el-input type="textarea" :rows="6" placeholder="请输入内容"
							v-model="remarksForm.brief"></el-input></el-form-item>
				</div>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click="remarksDialog = false">取 消</el-button>
				<el-button type="primary" @click="confirmClick(2, 'remarksForm')">确 定</el-button>
			</span>
		</el-dialog>

		<!-- 修改发货时间弹框 -->
		<el-dialog title="修改发货时间" :visible.sync="modifyTimeDialog" center :modal-append-to-body="false" width="40%">
			<el-form :model="modifyTimeForm" :rules="modifyTimeFormRules" ref="modifyTimeForm">
				<div class="info-exhibition">
					<el-form-item label="修改发货日期：:" prop="estimate_time">
						<el-date-picker v-model="modifyTimeForm.estimate_time" type="date" placeholder="选择日期"
							value-format="yyyy-MM-dd"></el-date-picker>
					</el-form-item>
				</div>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click="modifyTimeDialog = false">取 消</el-button>
				<el-button type="primary" @click="confirmClick(3, 'modifyTimeForm')">确 定</el-button>
			</span>
		</el-dialog>

		<!-- 商品入仓弹框 -->
		<el-dialog title="入仓" :visible.sync="WarehouseDialog" center :modal-append-to-body="false" width="680px">
			<el-form :model="WarehouseForm" :rules="WarehouseFormRules" ref="WarehouseForm" label-width="120px">
				<div class="remarks-info">
					<el-form-item label="体积:" prop="goods_bulk"><el-input placeholder="请输入体积"
							v-model="WarehouseForm.goods_bulk"></el-input></el-form-item>
					<el-form-item label="包件数:" prop="goods_pack">
						<el-input placeholder="请输入包件数" v-model="WarehouseForm.goods_pack" type="number"
							onKeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"></el-input>
					</el-form-item>
					<el-form-item label="分区:" prop="region_id">
						<el-cascader style="width:100%" v-model="WarehouseForm.region_id" :options="regionList"
							:props="{ children: 'child', value: 'region_id', label: 'region_name' }"></el-cascader>
						<!-- <el-select v-model="WarehouseForm.region_id" placeholder="请选择" style="width:100%">
						  <el-option v-for="item in regionList" :key="item.region_id" :value="item.region_id" :label="item.region_name">
							  <span v-html="item.spl"></span>
							  <span v-html="item.region_name"></span>
							  
						  </el-option>
						</el-select> -->
					</el-form-item>
				</div>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click="WarehouseDialog = false">取 消</el-button>
				<el-button type="primary" @click="confirmClick(4, 'WarehouseForm')">确 定</el-button>
			</span>
		</el-dialog>

		<!-- 改价弹框 -->
		<el-dialog title="订单改价" :visible.sync="priceChangeDialog" center :modal-append-to-body="false" width="580px">
			<el-form :model="priceChangeForm" :rules="priceChangeFormRules" ref="priceChangeForm" label-width="90px">
				<div style="line-height: 24px; margin-bottom: 12px;">
					<!-- <p>要修改的工厂编号: {{ changePriceInfo.factory_sn }}</p> -->
					<!-- <p>要修改的工厂名称: {{ changePriceInfo.factory_name }}</p> -->
					<p>要修改的商品编号: {{ changePriceInfo.goods_sn }}</p>
					<p>要修改的商品sku编号: {{ changePriceInfo.sku_sn }}</p>
					<p>原出厂金额: {{ changePriceInfo.goods_factory_price }}</p>
					<!-- <p>原订单自营价金额: {{ changePriceInfo.goods_self_price }}</p> -->
				</div>
				<!-- <el-form-item label="修改类型:" prop="type">
					<el-select v-model="priceChangeForm.type">
						<el-option label="订单改价" :value="2"></el-option>
						<el-option label="修改出厂价" :value="1"></el-option>
					</el-select>
				</el-form-item> -->
				<el-form-item label="修改金额:" prop="goods_factory_price">
					<el-input placeholder="请输入修改金额" v-model="priceChangeForm.goods_factory_price" type="number"
						onKeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))">
						<i slot="suffix">元</i>
					</el-input>
				</el-form-item>
				<!-- <el-form-item label="修改金额:" prop="goods_self_price" v-if="priceChangeForm.type == 2">
					<el-input placeholder="请输入修改金额" v-model="priceChangeForm.goods_self_price" type="number"
						onKeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))">
						<i slot="suffix">元</i>
					</el-input>
				</el-form-item> -->
				<el-form-item label="修改说明:" prop="brief">
					<el-input type="textarea" :rows="3" placeholder="请输入修改说明" v-model="priceChangeForm.brief"></el-input>
				</el-form-item>
				<el-form-item label="上传凭证：" prop="voucher_img" class="upload-box" style="padding-left: 0;">
					<div class="goods-img-upload">
						<div class="goods-img-upload-btns">
							<el-upload ref="upload" action="fakeaction"
								:show-file-list="false" :http-request="function (res) { return upload(1, res); }" multiple
								accept="image/*"> <el-button type="primary" size="small">上传图片</el-button>
							</el-upload>
							<!-- <el-button type="danger" size="small" @click="reset()">重置</el-button> -->
						</div>
						<div class="goods-img-upload-imgs">
							<el-image v-if="!priceChangeForm.voucher_img.length">
								<div slot="error"></div>
							</el-image>
							<div v-for="(data, index) in priceChangeForm.voucher_img" :key="index" class="vice_big_box" v-else>
								<i class="el-icon-error" @click="delVoucher(index)"></i>
								<el-image :preview-src-list="priceChangeForm.voucher_img" :src="data" fit="contain"></el-image>
							</div>
						</div>
					</div>
				</el-form-item>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click="priceChangeDialog = false">取 消</el-button>
				<el-button type="primary" @click="confirmClick(5, 'priceChangeForm')">确 定</el-button>
			</span>
		</el-dialog>
		<!-- 工厂改价 -->
		<el-dialog title="订单改价" :visible.sync="factoryChangeDialog" center :modal-append-to-body="false" width="480px">
			<el-form :model="factoryChangeForm" :rules="factoryChangeFormRules" ref="factoryChangeForm" label-width="120px">
				<el-form-item label="工厂价:" prop="goods_factory_price">
					<el-input placeholder="请输入拿货价" v-model="factoryChangeForm.goods_factory_price" type="number"
						onKeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))">
						<i slot="suffix">元</i>
					</el-input>
				</el-form-item>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click="factoryChangeDialog = false">取 消</el-button>
				<el-button type="primary" @click="confirmClick(6, 'factoryChangeForm')">确 定</el-button>
			</span>
		</el-dialog>
		<!-- 打款改价 -->
		<el-dialog title="打款改价" :visible.sync="remitChangeDialog" center :modal-append-to-body="false" width="480px">
			<el-form :model="remitForm" :rules="remitFormRules" ref="remitForm" label-width="120px">
				<el-form-item label="金额:" prop="money">
					<el-input placeholder="请输入金额" v-model="remitForm.money" type="number"
						onKeypress="return (/(?:^[1-9]([0-9]+)?(?:\.[0-9]{1,2})?$)|(?:^(?:0)$)|(?:^[0-9]\.[0-9](?:[0-9])?$)/g.test(event.keyCode))">
						<i slot="suffix">元</i>
					</el-input>
				</el-form-item>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click="remitChangeDialog = false">取 消</el-button>
				<el-button type="primary" @click="confirmClick(7, 'remitForm')">确 定</el-button>
			</span>
		</el-dialog>
		<!-- 后台备注 -->
		<el-dialog title="备注" :visible.sync="afterDialog" center :modal-append-to-body="false" width="680px">
			<el-form :model="afterForm" :rules="rafterFormRules" ref="afterForm" label-width="120px">
				<div class="remarks-info">
					<el-form-item label="备注:" prop="inside_remark"><el-input type="textarea" :rows="6"
							placeholder="请输入备注,此备注只在后台显示" v-model="afterForm.inside_remark"></el-input></el-form-item>
				</div>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click="afterDialog = false">取 消</el-button>
				<el-button type="primary" @click="confirmClick(8, 'afterForm')">确 定</el-button>
			</span>
		</el-dialog>
		<!-- 打印唛头确定包件数 -->
		<el-dialog title="确认包件数" :visible.sync="factoryConfirmDialog" center :modal-append-to-body="false" width="500px">
			<el-form :model="factoryConfirmForm" :rules="factoryConfirmFormRules" ref="factoryConfirmForm"
				label-width="120px">
				<div class="remarks-info">
					<el-form-item label="包件数:" prop="goods_pack">
						<el-input placeholder="请输入包件数" v-model.number="factoryConfirmForm.goods_pack"></el-input>
					</el-form-item>
				</div>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click="factoryConfirmDialog = false">取 消</el-button>
				<el-button type="primary" @click="confirmClick(9, 'factoryConfirmForm')">确 定</el-button>
			</span>
		</el-dialog>
		<!-- 移区 -->
		<el-dialog title="移区" :close-on-click-modal="false" :visible.sync="partitionDialog" center
			:modal-append-to-body="false" width="500px">
			<el-form :model="warehouseForm" :rules="warehouseFormRules" ref="warehouseForm" label-width="100px">
				<div class="menu-dialog">
					<el-form-item label="区域:" prop="region_id">
						<el-cascader v-model="warehouseForm.region_id" :options="regionList"
							:props="{ children: 'child', value: 'region_id', label: 'region_name' }" style="width:100%"></el-cascader>
					</el-form-item>
				</div>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click="partitionDialog = false"> 取 消 </el-button>
				<el-button type="primary" @click="confirmClick(10, 'warehouseForm')">确 定</el-button>
			</span>
		</el-dialog>
		<!-- 指派工厂 -->
		<el-dialog title="指派工厂" :close-on-click-modal="false" :visible.sync="assignDialog" center append-to-body
			width="500px">
			<el-form :model="assignForm" :rules="assignRules" ref="assignForm" label-width="170px">
				<div class="menu-dialog">
					<p style="padding-bottom: 24px;">当前要指派的商品编号：{{ assginInfo.goods_sn }}</p>
					<el-form-item label="请选择您要指派的工厂:" prop="factory_id">
						<el-select v-model="assignForm.factory_id" filterable @change="assignFactoryChange">
							<el-option v-for="item in FactoryAssignList" :key="item.factory_id" :label="item.factory_name"
								:value="item.factory_id">
							</el-option>
						</el-select>
					</el-form-item>
					<p v-if="assignForm.factory_id">指派后出厂价：￥{{ assginPrice }}</p>
				</div>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click="assignDialog = false"> 取 消 </el-button>
				<el-button type="primary" @click="confirmClick(11, 'assignForm')">确 定</el-button>
			</span>
		</el-dialog>
		<!-- 更换产品 -->
		<el-dialog title="更换产品" :close-on-click-modal="false" :visible.sync="changeGoodsDialog" center append-to-body
			width="500px">
			<el-form :model="changeGoodsForm" ref="changeGoodsForm" label-width="170px">
				<div class="change-goods-dialog">
					<div class="old-info">
						<p><label>原商品编号：</label>{{ changeGoodsInfo.goods_sn }}</p>
						<p><label>原商品sku编号：</label>{{ changeGoodsInfo.sku_sn }}</p>
						<p><label>原商品规格：</label>{{ changeGoodsInfo.color }}、{{ changeGoodsInfo.size }}、{{ changeGoodsInfo.lining }}</p>
						<p><label>原商品下单数：</label>{{ changeGoodsInfo.goods_number }}</p>
						<p><label>原商品单价：</label>￥{{ changeGoodsInfo.goods_self_price }}</p>
						<p><label>原商品总价：</label>￥{{ (Number(changeGoodsInfo.goods_self_price) * changeGoodsInfo.goods_number).toFixed(2) }}</p>
					</div>
					<ul>
						<li v-for="(data, index) in changeGoodsForm.upimg" :key="index">
							<h1>商品{{ index+1 }}信息：<el-button type="danger" size="mini" plain v-if="changeGoodsForm.upimg.length > 1" @click="delChangeGoods(index)">删除</el-button></h1>
							<div class="input">
								<label>目标sku编号：</label>
								<el-input v-model="data.sku_sn" placeholder="填写更换目标sku编号" @blur="getOrderFactoryList(data.sku_sn,index)" />
							</div>
							<div class="input">
								<label>数量：</label>
								<el-input v-model="data.num" placeholder="请输入数量" />
							</div>
							<div class="input">
								<label>选择工厂：</label>
								<el-select placeholder="请选择需要下单的工厂" style="width: 100%"  v-model="data.factory_id" clearable filterable>
									<el-option v-for="(data,index) in data.factoryList" :key="index" :label="data.factory_name" :value="data.factory_id">
									</el-option>
								</el-select>
							</div>
							<div class="input" style="margin-top: 0;">
								<label>是否定制：</label>
								<el-switch v-model="data.is_customized" :active-value="1" :inactive-value="0"></el-switch>
							</div>
							<div class="input" style="margin-top: 0;">
								<label>下单备注：</label>
								<el-input type="textarea" :rows="2" v-model="data.brief" placeholder="请输入下单备注" />
							</div>
						</li>
					</ul>
					<el-button type="success" size="mini" plain @click="addChangeGoods" style="margin-top: 12px;">增加商品</el-button>
					<h2>更改凭证{{changeGoodsForm.change_voucher.length}}/5：</h2>
					<div class="upload-box" style="padding-left: 0;">
						<div class="goods-img-upload">
							<div class="goods-img-upload-btns">
								<el-upload ref="upload" action="fakeaction"
									:show-file-list="false" :http-request="function (res) { return upload(2, res); }" multiple
									accept="image/*"> <el-button type="primary" size="small">上传图片</el-button>
								</el-upload>
								<!-- <el-button type="danger" size="small" @click="reset()" style="margin-top: 10px;">重置</el-button> -->
							</div>
							<div class="goods-img-upload-imgs">
								<el-image v-if="!changeGoodsForm.change_voucher.length">
									<div slot="error"></div>
								</el-image>
								<div v-for="(data, index) in changeGoodsForm.change_voucher" :key="index" class="vice_big_box" v-else>
									<i class="el-icon-error" @click="delChangeVoucher(index)"></i>
									<el-image :preview-src-list="changeGoodsForm.change_voucher" :src="data" fit="contain"></el-image>
								</div>
							</div>
						</div>
					</div>
					<h2>更改说明：</h2>
					<el-input type="textarea" :rows="3" v-model="changeGoodsForm.change_brief" placeholder="请输入更改说明"></el-input>
				</div>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click="changeGoodsDialog = false"> 取 消 </el-button>
				<el-button type="primary" @click="confirmClick(12, 'changeGoodsForm')">确 定</el-button>
			</span>
		</el-dialog>
	</div>
</template>

<script>
import editLogistics from '@/components/layer-dialog/edit-logistics.vue';
import ImgPopover from '@/components/ImgPopover';
export default {
	components: {
		ImgPopover,
		editLogistics
	},
	data() {
		return {
			notifyShipDialog: false,
			notifyShipForm: {
				notice_time:'',
				order_sn: '',
				rec_id:'',
			},
			serverOptions: [
				{
					label: '物流点自提'
				},
				{
					label: '送货到业主家'
				},
				{
					label: '送货+安装'
				}
			],
			infoForm: {
				goods_pack: '',
				order_id: ''
			},
			goodsIndex: null,
			order_id: '', // 订单ID
			admin_type: localStorage.getItem('admin_type'),
			admin_id: localStorage.getItem('admin_id'), // admin_id 理员 1是总号，2是商家，3是厂家，4财务，5招商，6产品，7仓管 8收费厂家 9.外部招商员
			user_id: localStorage.getItem('user_id'),
			factoryDialog: false, // 工厂物流发货到平台弹框
			logisticsDialog: false, // 仓库上传物流弹框
			remarksDialog: false, // 备注弹框
			modifyTimeDialog: false, // 修改发货时间弹框
			WarehouseDialog: false, // 入仓弹框
			imageUrl: [],
			imageUrlShow: [],
			shippingList: [], // 准备发货的商品信息集合
			logisticsForm: {
				expressCompany: '',
				express_sn: '',
				express_img: '',
				express_remark: ''
			}, // 上传物流的信息
			factoryForm: {
				rec_id: '',
				logistics_img: ''
			},
			remarksForm: {
				rec_id: '',
				brief: ''
			},
			remarksFormRules: {
				brief: [{ required: true, message: '请输入平台备注' }]
			},
			// 物流校对规则
			logisticsFormRules: {
				expressCompany: [{ required: true, message: '请输入物流公司' }],
				express_img: [{ required: true, message: '请上传物流图片' }]
			},
			factoryFormRules: {
				logistics_img: [{ required: true, message: '请上传物流图片' }]
			},
			modifyTimeForm: {
				// 修改发货时间
				estimate_time: '',
				rec_id: ''
			},
			modifyTimeFormRules: {
				estimate_time: [{ required: true, message: '请选择日期' }]
			},
			WarehouseForm: {
				// 入仓
				rec_id: '',
				goods_bulk: '',
				goods_pack: '',
				region_id: ''
			},
			WarehouseFormRules: {
				goods_bulk: [{ required: true, message: '请输入体积' }],
				goods_pack: [{ required: true, message: '请输入包件数' }],
				region_id: [{ required: true, message: '请选择分区' }]
			},
			show: false,
			orderInfo: '',
			goodsList: [],
			platformWarehouse: '', // 平台仓库
			priceChangeDialog: false,
			factoryChangeDialog: false,
			priceChangeForm: {
				rec_id: '',
				order_id: '',
				type: 1,
				brief: '',
				voucher_img: [],
				goods_factory_price: '',
				goods_self_price: '',
			},
			priceChangeFormRules: {
				type: [{ required: true, message: '请选择改价类型' }],
				goods_factory_price: [{ required: true, message: '请输入修改金额' }],
				goods_self_price: [{ required: true, message: '请输入修改金额' }],
				voucher_img: [{ type: 'array', required: true, message: '请上传凭证' }],
			},
			changePriceInfo: '',
			factoryChangeForm: {
				goods_factory_price: '',
				rec_id: '',
				order_id: ''
			},
			factoryChangeFormRules: {
				goods_factory_price: [{ required: true, message: '请输入工厂价' }]
			},
			list: [],
			remitChangeDialog: false,
			remitForm: {
				factory_pay_id: '',
				money: ''
			},
			remitFormRules: {
				money: [{ required: true, message: '请输入修改金额' }]
			},
			afterForm: {
				order_id: '',
				rec_id: '',
				inside_remark: ''
			},
			afterDialog: false,
			rafterFormRules: {
				inside_remark: [{ required: true, message: '请输入备注，此备注只在后台显示' }]
			},
			printingForm: {
				rec_id: '',
				goods_pack: '',
			},
			factoryConfirmForm: {
				order_id: '',
				rec_id: '',
				goods_pack: ''
			},
			factoryConfirmDialog: false,
			factoryConfirmFormRules: {
				goods_pack: [{ required: true, message: '请输入包件数' }]
			},
			regionList: [],
			partitionDialog: false,
			warehouseForm: {
				order_id: '',
				rec_id: '',
				region_id: ''
			},
			warehouseFormRules: {
				region_id: [{ required: true, message: "请选择分区" }],
			},
			useMoneyDetailList: [],//商家转账详情
			goodsBulkIndex: null,
			bulkForm: {
				goods_bulk: '',
				order_id: '',
				rec_id: '',
			},
			assginInfo: '',
			assignDialog: false,
			assginPrice: 0,
			is_frame: 0,
			FactoryAssignList: [],
			assignForm: {
				order_id: '',
				rec_id: '',
				factory_id: ''
			},
			assignRules: {
				factory_id: [{ required: true, message: "请选择需要指派的工厂" }],
			},
			changeGoodsDialog: false,
			changeGoodsInfo: '',
			changeGoodsForm: {
				order_id: '',
				rec_id: '',
				change_voucher: [],
				change_brief: '',
				upimg: [{
					factoryList: [],
					factory_id: '',
					sku_sn: '',
					num: '',
					is_customized: '',
					brief: ''
				}]
			},
		};
	},
	watch: {
		'WarehouseForm.goods_pack': function () {
			if (this.WarehouseForm.goods_pack < 0) {
				this.WarehouseForm.goods_pack = 0;
				this.$message.error('请输入包件数');
			}
		},
		'infoForm.goods_pack': function (val) {
			if (val < 0) {
				this.infoForm.goods_pack = 1;
			}
		},
		assignDialog(n, o) {
			if (!n) {
				this.assignForm = this.$options.data().assignForm
			}
		},
		changeGoodsDialog(n, o) {
			if (!n) {
				this.changeGoodsForm = this.$options.data().changeGoodsForm
			}
		},
		notifyShipDialog(n,o){
			if(!n){
				this.notifyShipForm = this.$options.data().notifyShipForm
			}
		},
	},
	methods: {
		produceComplate(){
			this.$confirm('您确定当前所选产品生产完成吗？', '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
			}).then(() => {
				this.$http(this.$ApiList.ProduceConfirm,{order_sn: this.orderInfo.order_sn,factory_sn: localStorage.getItem('factory_sn'),rec_id: this.shippingList.map(item => item.rec_id).join(',') }).then(res => {
					if(res.code == 200){
						this.$layer.msg('操作成功')
						this.init()
					}
				})
			}).catch(() => {

			});
		},
		notifyShip(){
			this.notifyShipForm.order_sn = this.orderInfo.order_sn
			this.notifyShipForm.rec_id = this.shippingList.map(item => item.rec_id).join(',')
			this.notifyShipDialog = true
		},
		confirmNotifyShip(){
			this.$http(this.$ApiList.NoticeSend, this.notifyShipForm).then(res => {
				if(res.code == 200){
					this.$layer.msg('通知成功')
					this.notifyShipDialog = false
				}
			})
		},
		getOrderFactoryList(e,index){
			console.log(e)
			if(e){
				this.$http(this.$ApiList.orderFactoryList,{sku_sn: e}).then(res => {
					if(!res.datas.length){
						return this.$layer.msg('根据当前sku未找到工厂，请重新输入');
					}
					this.changeGoodsForm.upimg[index].factoryList = res.datas
				})
			}else{
				this.changeGoodsForm.upimg[index].factoryList = []
			}
		},
		delChangeGoods(index){
			this.changeGoodsForm.upimg.splice(index,1)
		},
		addChangeGoods(){
			this.changeGoodsForm.upimg.push({
				factoryList: [],
				factory_id: '',
				sku_sn: '',
				num: '',
				is_customized: '',
				brief: ''
			})
		},
		delChangeVoucher(index){
			this.changeGoodsForm.change_voucher.splice(index,1)
		},
		// 更换产品
		changeGoods(row) {
			this.changeGoodsInfo = row
			this.changeGoodsForm.order_id = row.order_id
			this.changeGoodsForm.rec_id = row.rec_id
			this.changeGoodsDialog = true
		},
		// 非定制改定制
		async customChange(e, row) {
			try {
				await this.$http(this.$ApiList.OrderGoodsCustomized, { order_id: row.order_id, rec_id: row.rec_id, is_customized: e })
				this.$layer.msg('修改成功')
			} finally {
				this.init()
			}
		},
		// 指派工厂
		assign(row) {
			this.assginInfo = row
			this.assignForm.order_id = row.order_id
			this.assignForm.rec_id = row.rec_id
			this.$http(this.$ApiList.FactoryAssignList, { order_id: row.order_id, rec_id: row.rec_id }).then(res => {
				if (res.code == 200) {
					this.FactoryAssignList = res.datas
					this.assignDialog = true
				}
			})
		},
		assignFactoryChange(e) {
			if (this.assignForm.factory_id) {
				this.assginPrice = this.FactoryAssignList.find(item => item.factory_id == this.assignForm.factory_id).factory_price
				this.is_frame = this.FactoryAssignList.find(item => item.factory_id == this.assignForm.factory_id).is_frame
			} else {
				this.assginPrice = 0
			}
		},
		// 删除凭证
		delVoucher(index) {
			this.priceChangeForm.voucher_img.splice(index, 1)
		},
		// 确认收货
		ConfirmReceipt(order_id) {
			this.$confirm('确认收货后资金将进入解冻倒计时流程', '温馨提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
			})
				.then(() => {
					this.$http(this.$ApiList.OrderConfirm, { order_id }).then(res => {
						if (res.code == 200) {
							this.$message({
								message: '确认收货成功',
								type: 'success'
							});
							this.init();
						}
					});
				})
				.catch(() => { });
		},
		// 取消订单商品
		OrderGoodsCancel(row) {
			this.$confirm('取消后不可恢复，是否确定取消此商品？', '温馨提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
			})
				.then(() => {
					this.$http(this.$ApiList.OrderGoodsCancel, { order_id: row.order_id, rec_id: row.rec_id }).then(res => {
						if (res.code == 200) {
							this.$message({
								message: '取消成功',
								type: 'success'
							});
							this.init();
						}
					});
				})
				.catch(() => { });
		},
		// 延长冻结
		ExtendFrozen(row) {
			this.$prompt('请输入延长天数', '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				inputValue: '',
				beforeClose: (action, instance, done) => {
					console.log(action, instance)
					if (action === 'cancel') {
						done()
						return
					} else if (action === 'confirm') {
						let obj = {
							order_id: row.order_id,
							rec_id: row.rec_id,
							thaw_day: instance.inputValue
						}
						this.$http(this.$ApiList.ExtendFrozen, obj).then(res => {
							this.$layer.msg('延长成功')
							this.init()
							done()
						})
					}
				}
			}).then(({ value }) => {

			}).catch(() => { });
		},
		init() {
			this.order_id = this.$route.query.id;
			let data = {
				order_id: this.order_id
			};
			if (this.admin_id == 3) {
				data.factory_sn = localStorage.getItem('factory_sn');
			}

			this.$http(this.$ApiList.OrderInfo, data).then(res => {
				this.goodsList = [];
				this.orderInfo = res.datas;
				// 商家物流方向
				if (this.orderInfo.express_move == 1) {
					this.orderInfo.direction = '用户地址';
					this.orderInfo.direction_detailed = this.orderInfo.address_id.city + this.orderInfo.address_id.district + this.orderInfo.address_id.address;
				} else if (this.orderInfo.express_move == 2) {
					this.orderInfo.direction = '商家仓库';
					this.orderInfo.direction_detailed = this.orderInfo.express_address.city + this.orderInfo.express_address.district + this.orderInfo.express_address.address;
				} else if (this.orderInfo.express_move == 3) {
					this.orderInfo.direction = '平台仓库';
					this.orderInfo.direction_detailed = this.platformWarehouse;
				}
				// 厂家物流方向
				let factory = ['', '发货到客户', '发货到商家', '平台仓库'];
				this.orderInfo.factory_direction = factory[res.datas.factory_move];

				// 厂家发货信息
				if (this.orderInfo.factory_move == 3) {
					this.orderInfo.shippingInfo = this.orderInfo.factory_address_id;
				} else {
					this.orderInfo.shippingInfo = this.orderInfo.address_id;
				}

				if(res.datas.goods_list && res.datas.goods_list.length){
					res.datas.goods_list.forEach(item => {
						let status = ['待付款', '待商家确认', '待平台确认', '待发货', '待收货', '已成交', '已取消','待工厂确认'];
						item.status_text = status[item.status];

						let warehouse = ['未入仓', '入仓'];
						item.warehouse_text = warehouse[item.is_warehouse];

						let afterSale = ['无', '申请售后', '处理中', '售后完成'];
						item.afterSale_text = afterSale[item.after_sale];

						if (item.group_id == null) {
							item.group_text = '单品';
						} else {
							item.group_text = '套餐';
						}

						this.goodsList.push(item);
					});
				}
				

				this.show = true;
			});
			this.$http(this.$ApiList.SelectRegionList).then(res => {
				const { datas } = res
				this.regionList = datas
			})
			if (this.admin_id == 2 || this.admin_id == 16) {
				this.getUseMoneyDetailList()
			}
		},
		//提交
		confirmClick(type, formName) {
			// type 0 仓库上传物流图片 和 工厂发货到客户 1 工厂发货到平台 2 商品备注 3 平台修改发货时间 4入仓
			if (this.imageUrl.length != 0) {
				let imageUrl = [];
				this.imageUrl.forEach(item => {
					imageUrl.push(item.image);
				});
				if (type == 0) {
					if (this.admin_id == 3) {
						this.logisticsForm.logistics_img = imageUrl.join(',');
					} else {
						this.logisticsForm.express_img = imageUrl.join(',');
					}
				} else {
					this.factoryForm.logistics_img = imageUrl.join(',');
				}
			} else {
				this.logisticsForm.logistics_img = '';
				this.logisticsForm.express_img = '';
				this.factoryForm.logistics_img = '';
			}
			this.$refs[formName].validate(valid => {
				if (valid) {
					if (type == 0) {
						if (this.admin_id == 3) {
							// admin_id == 3工厂
							// this.$http(this.$ApiList.publicUpload, this.logisticsForm.express_img).then(res => {
							// 	this.logisticsForm.logistics_img = res.datas[0];
							delete this.logisticsForm.express_img;
							delete this.logisticsForm.express_remark;
							this.logisticsForm.factory_sn = localStorage.getItem('factory_sn');
							this.logisticsForm.factory_move = 1;

							this.$http(this.$ApiList.OrderFactoryLogistics, this.logisticsForm).then(res => {
								this.$layer.msg('提交成功');
								this.logisticsDialog = false;
								this.init();
							});
							// });
						} else {
							// 仓库
							// this.$http(this.$ApiList.publicUpload, this.logisticsForm.express_img).then(res => {
							// 	this.logisticsForm.express_img = res.datas[0];
							this.$http(this.$ApiList.OrderDeliver, this.logisticsForm).then(res => {
								this.$layer.msg('提交成功');
								this.logisticsDialog = false;
								this.init();
							});
							// });
						}
					} else if (type == 1) {
						// this.$http(this.$ApiList.publicUpload, this.factoryForm.logistics_img).then(res => {
						// 	this.factoryForm.logistics_img = res.datas[0];
						this.$http(this.$ApiList.OrderFactoryLogistics, this.factoryForm).then(res => {
							this.$layer.msg('提交成功');
							this.factoryDialog = false;
							this.init();
						});
						// });
					} else if (type == 2) {
						this.$http(this.$ApiList.UpOrderGoodsRemark, this.remarksForm).then(res => {
							this.$layer.msg('提交成功');
							this.remarksDialog = false;
							this.init();
						});
					} else if (type == 3) {
						this.$http(this.$ApiList.UpOrderGoodsEstimateTime, this.modifyTimeForm).then(res => {
							this.$layer.msg('修改成功');
							this.modifyTimeDialog = false;
							this.init();
						});
					} else if (type == 4) {
						this.WarehouseForm.region_id = this.WarehouseForm.region_id.pop()
						this.$http(this.$ApiList.OrderIntoWarehouse, this.WarehouseForm).then(res => {
							this.$layer.msg('入仓成功');
							this.WarehouseDialog = false;
							this.init();
						});
					} else if (type == 5) {
						let data = {
							rec_id: this.priceChangeForm.rec_id,
							order_id: this.priceChangeForm.order_id,
							type: this.priceChangeForm.type,
							brief: this.priceChangeForm.brief,
							voucher_img: this.priceChangeForm.voucher_img.join(','),
							goods_factory_price: this.priceChangeForm.goods_factory_price,
							goods_self_price: this.priceChangeForm.goods_self_price,
						}
						this.$http(this.$ApiList.OrderChangePrice, data).then(res => {
							this.$layer.msg('改价成功');
							this.priceChangeDialog = false;
							this.init();
							this.priceChangeForm.goods_self_price = '';
							this.priceChangeForm.type = 1
						});
					} else if (type == 6) {
						this.$http(this.$ApiList.OrderChangeFactoryPrice, this.factoryChangeForm).then(res => {
							// this.$layer.msg('改价成功');
							this.factoryChangeDialog = false;
							this.init();
							this.factoryChangeForm.goods_factory_price = '';
						})
					} else if (type == 7) {
						this.$http(this.$ApiList.ChangePrice, this.remitForm).then(res => {
							this.$layer.msg('打款价格修改成功');
							this.remitChangeDialog = false;
							this.$refs[formName].resetFields();
							this.init();
						})
					} else if (type == 8) {
						this.$http(this.$ApiList.UpdateOrderGoodsRemark, this.afterForm).then(res => {
							this.$refs[formName].resetFields();
							this.$layer.msg(res.datas);
							this.afterDialog = false;
							this.init()
						})
					} else if (type == 9) {
						this.$http(this.$ApiList.OrderGoodsPackConfirm, this.factoryConfirmForm).then(res => {
							this.factoryConfirmDialog = false
							this.onGoToPrinting()
						})
					} else if (type === 10) {
						this.warehouseForm.region_id = this.warehouseForm.region_id.pop()
						this.$http(this.$ApiList.OrderGoodsRegion, this.warehouseForm).then(res => {
							this.$layer.msg('移区成功')
							this.partitionDialog = false
							this.init()
						})
					} else if (type == 11) {
						if (this.is_frame == 1) {
							this.$confirm('当前所指派工厂当前产品库存不足，是否指派该工厂发货？', '提示', {
								confirmButtonText: '确定',
								cancelButtonText: '取消',
								type: 'warning'
							})
								.then(() => {
									this.$http(this.$ApiList.AssignFactory, this.assignForm).then(res => {
										this.$layer.msg('指派成功')
										this.assignDialog = false
										this.init()
									})
								})
								.catch(() => { });
						} else {
							this.$http(this.$ApiList.AssignFactory, this.assignForm).then(res => {
								this.$layer.msg('指派成功')
								this.assignDialog = false
								this.init()
							})
						}
					}else if(type==12){
						for(let i in this.changeGoodsForm.upimg){
							if(!this.changeGoodsForm.upimg[i].sku_sn || !this.changeGoodsForm.upimg[i].num || !this.changeGoodsForm.upimg[i].factory_id){
								return this.$layer.msg(`商品${Number(i)+1}的sku编号、数量、工厂不能为空，请完善后再提交`)
							}
						}
						this.$http(this.$ApiList.CheckStock,{upimg: JSON.stringify(this.changeGoodsForm.upimg)}).then(res => {
							if(res.datas.length){
								let content = ''
								res.datas.forEach(item => {
									content += `<p>当前所指派工厂“${item.factory_name}” 商品：“${item.sku_sn}” 库存为0</p>`
								})
								this.$confirm(`<h4>以下工厂库存不足，是否指派以下工厂发货？</h4>${content}`, '温馨提示', {
									confirmButtonText: '确定',
									cancelButtonText: '取消',
									dangerouslyUseHTMLString: true,
									type: 'warning',
									customClass: 'noStock'
								})
								.then(() => {
									this.$http(this.$ApiList.ChangeGoods, {
										order_id: this.changeGoodsForm.order_id,
										rec_id: this.changeGoodsForm.rec_id,
										change_voucher: this.changeGoodsForm.change_voucher.join(','),
										change_brief: this.changeGoodsForm.change_brief,
										upimg: JSON.stringify(this.changeGoodsForm.upimg)
									}).then(res => {
										this.$layer.msg('更改成功')
										this.changeGoodsDialog = false
										this.init()
									})
								})
								.catch(() => { });
							}else{
								this.$http(this.$ApiList.ChangeGoods, {
									order_id: this.changeGoodsForm.order_id,
									rec_id: this.changeGoodsForm.rec_id,
									change_voucher: this.changeGoodsForm.change_voucher.join(','),
									change_brief: this.changeGoodsForm.change_brief,
									upimg: JSON.stringify(this.changeGoodsForm.upimg)
								}).then(res => {
									this.$layer.msg('更改成功')
									this.changeGoodsDialog = false
									this.init()
								})
							}
						})
					}
				} else {
					this.$layer.msg('请填写完整信息后提交');
				}
			});
		},
		// 物流图片上传
		upload(type, params) {
			if ((type == 1 && this.priceChangeForm.voucher_img.length >= 5) || (type == 2 && this.changeGoodsForm.change_voucher.length >= 5)) {
				return this.$message.error('最多上传5张');
			}
			const file = params.file,
				isJPGPNG = file.type === 'image/jpeg' || file.type === 'image/png',
				isLt3MB = file.size / 1024 <= 3024;
			if (!isJPGPNG) {
				this.$layer.msg('只能上传图片格式png、jpg!');
				return;
			}
			if (!isLt3MB) {
				this.$layer.msg('图片不能大于3M');
				return;
			}

			let img = new FormData();
			img.append('file[]', file);

			this.$http(this.$ApiList.publicUpload, img).then(res => {
				if (type == 1) {
					this.priceChangeForm.voucher_img.push(res.datas[0])
				} else if (type == 2) {
					this.changeGoodsForm.change_voucher.push(res.datas[0])
				} else {
					this.imageUrl.push({
						image: res.datas[0]
					});
					this.imageUrlShow.push(res.datas[0]);
				}
			});
		},
		// 重置
		reset() {
			this.imageUrl = [];
			this.imageUrlShow = [];
		},
		// 批量发货
		delivery() {
			if (this.shippingList.length == 0) {
				this.$message({
					message: '至少要选择一件商品',
					type: 'warning'
				});
				return;
			}
			this.logisticsDialog = true;
			this.logisticsForm.order_id = this.order_id;
			this.logisticsForm.rec_id = ''; // 多个订单，以逗号隔开
			this.shippingList.forEach(item => {
				this.logisticsForm.rec_id += item.rec_id + ',';
			});
			this.logisticsForm.rec_id = this.logisticsForm.rec_id.substr(0, this.logisticsForm.rec_id.length - 1);
			// factory_move 1直接发货到客户 3送到平台
			// factory_move = 1 的时候，工厂发货，就要上传一个物流单号，物流公司名称，物流图片  ,
			//factory_move = 3 的时候，工厂发货或者叫上传物流单的时候，就只上传一张图片
			// console.log(this.admin_id,this.orderInfo.factory_move)
			// if (this.admin_id == 3 && this.orderInfo.factory_move == 3) {
			// 	this.factoryDialog = true;
			// 	this.factoryForm.rec_id = ''; // 工厂发货 多个订单，以逗号隔开
			// 	this.factoryForm.order_id = this.order_id;
			// 	this.factoryForm.factory_sn = this.shippingList[0].factory_sn;
			// 	this.shippingList.forEach(item => {
			// 		this.factoryForm.rec_id += item.rec_id + ',';
			// 	});
			// 	this.factoryForm.rec_id = this.factoryForm.rec_id.substr(0, this.factoryForm.rec_id.length - 1);
			// }
			// if (this.admin_id == 3 && this.orderInfo.factory_move == 1) {
				// this.logisticsDialog = true;
				// this.logisticsForm.order_id = this.order_id;
				// this.logisticsForm.rec_id = ''; // 多个订单，以逗号隔开
				// this.shippingList.forEach(item => {
				// 	this.logisticsForm.rec_id += item.rec_id + ',';
				// });
				// this.logisticsForm.rec_id = this.logisticsForm.rec_id.substr(0, this.logisticsForm.rec_id.length - 1);
			// } else if (this.admin_id == 7 || this.admin_id == 13) {
			// 	this.logisticsDialog = true;
			// 	this.logisticsForm.order_id = this.order_id;
			// 	this.logisticsForm.rec_id = ''; // 仓库发货 多个订单，以逗号隔开
			// 	this.shippingList.forEach(item => {
			// 		this.logisticsForm.rec_id += item.rec_id + ',';
			// 	});
			// 	this.logisticsForm.rec_id = this.logisticsForm.rec_id.substr(0, this.logisticsForm.rec_id.length - 1);
			// }
		},
		// 修改发货时间
		modifyTime(rec_id) {
			this.modifyTimeForm.rec_id = rec_id;
			this.modifyTimeDialog = true;
		},
		// 设置商品备注
		setBrief(rec_id, brief) {
			this.remarksForm.rec_id = rec_id;
			this.remarksForm.brief = brief;
			this.remarksDialog = true;
		},
		// 打印唛头
		printing(row) {
			this.printingForm.rec_id = row.rec_id;
			this.printingForm.goods_pack = row.goods_pack;
			if (this.admin_id == 3) {
				if (row.factory_confirm === 0) {
					this.factoryConfirmDialog = true
					this.factoryConfirmForm.order_id = this.order_id;
					this.factoryConfirmForm.rec_id = row.rec_id;
				} else if (row.factory_confirm === 1) {
					this.onGoToPrinting();
				}
			} else {
				this.onGoToPrinting();
			}
		},
		onGoToPrinting() {
			const { goods_pack, rec_id } = this.printingForm
			if (goods_pack == 0 || goods_pack == null) {
				this.$layer.msg('包件数不能为0，请修改包件数');
				return;
			}
			const { href } = this.$router.resolve({ path: '/maitou', query: { id: rec_id, order_sn: this.orderInfo.order_sn, order_id: this.order_id, is_collate: this.orderInfo.is_collate } })
			window.open(href, '_blank')
		},
		// 选中的商品信息
		handleSelectionChange(val) {
			this.shippingList = val;
		},
		// 入仓
		warehouse(rec_id, goods_bulk, goods_pack, region_id) {
			this.WarehouseDialog = true;
			this.WarehouseForm.rec_id = rec_id;
			this.WarehouseForm.goods_bulk = goods_bulk;
			this.WarehouseForm.goods_pack = goods_pack;
			if (region_id) {
				this.regionList.map((item) => {
					item.child.map((data) => {
						if (data.region_id == region_id) {
							this.$set(this.WarehouseForm, "region_id", [
								item.region_id,
								data.region_id,
							]);
						}
					});
				});
			} else {
				this.WarehouseForm.region_id = ''
			}
		},
		// 出仓
		onGoWarehouse(rec_id) {
			this.$http(this.$ApiList.OrderOutbound, { rec_id }).then(res => {
				this.$message.success(res.datas)
			})
		},
		// 移区
		onMoveWarehouse(rec_id, region_id = '') {
			this.warehouseForm.order_id = this.order_id
			this.warehouseForm.rec_id = rec_id
			if (region_id) {
				this.regionList.map((item) => {
					item.child.map((data) => {
						if (data.region_id == region_id) {
							this.$set(this.warehouseForm, "region_id", [
								item.region_id,
								data.region_id,
							]);
						}
					});
				});
			}
			this.partitionDialog = true
		},
		// 返回
		goBack() {
			this.$router.go(-1);
		},
		// 获取仓库地址
		getWarehouse() {
			this.$http(this.$ApiList.platformAddressList).then(res => {
				this.platformWarehouse = res.datas;
			});
		},
		// 商品详情
		goodsDetails(goodsId) {
			this.$router.push({ path: '/goods_details', query: { type: 1, id: goodsId } });
		},
		// 修改包件数
		setPack(goodsIndex, order_id, goods_pack, rec_id) {
			this.goodsIndex = goodsIndex;
			this.infoForm.goods_pack = goods_pack;
			this.infoForm.order_id = order_id;
			this.infoForm.rec_id = rec_id;
		},
		// 修改体积
		setBulk(goodsIndex, order_id, goods_bulk, rec_id) {
			console.log(goods_bulk)
			this.goodsBulkIndex = goodsIndex;
			this.bulkForm.goods_bulk = goods_bulk;
			this.bulkForm.order_id = order_id;
			this.bulkForm.rec_id = rec_id;
		},
		postBulk(type) {
			//  0 确定 1取消
			if (type == 0) {
				if (this.admin_id != 3 && this.admin_id != 13 && this.admin_id != 32) {
					this.$layer.msg('没有权限修改');
					return;
				}
				if (this.bulkForm.goods_bulk == '') {
					this.$layer.msg('体积不能为空，请输入体积');
					return;
				}
				this.$http(this.$ApiList.UpdateOrderGoodsBulk, this.bulkForm).then(res => {
					this.goodsBulkIndex = null;
					this.init();
				});
			} else {
				this.goodsBulkIndex = null;
			}
		},
		postPack(type) {
			//  0 确定 1取消
			if (type == 0) {
				if (this.admin_id != 3 && this.admin_id != 13 && this.admin_id != 32) {
					this.$layer.msg('没有权限修改');
					return;
				}
				if (this.infoForm.goods_pack == '') {
					this.$layer.msg('包件数不能为空，请修改包件数');
					return;
				}
				this.$http(this.$ApiList.UpdateOrderGoodsPack, this.infoForm).then(res => {
					this.goodsIndex = null;
					this.init();
				});
			} else {
				this.goodsIndex = null;
			}
		},
		priceChange(row) {
			this.priceChangeDialog = true;
			this.changePriceInfo = row
			this.priceChangeForm.rec_id = row.rec_id;
			this.priceChangeForm.order_id = this.orderInfo.order_id;
		},
		factoryChange(rec_id) {
			this.factoryChangeDialog = true;
			this.factoryChangeForm.rec_id = rec_id;
			this.factoryChangeForm.order_id = this.orderInfo.order_id;
		},
		delVice(index) {
			this.$confirm('删除后不可恢复，是否确认删除?', '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
			})
				.then(() => {
					this.imageUrl.splice(index, 1);
					this.imageUrlShow.splice(index, 1);
				})
				.catch(() => { });
		},
		editLogisticsPoint() {
			let info;
			if (this.orderInfo.order_logistics == null) {
				info = {
					order_sn: this.orderInfo.order_sn,
					start_consignee: '',
					company_name: '',
					start_mobile: '',
					start_landline: '',
					start_province: '',
					start_city: '',
					start_district: '',
					start_address: '',
					end_consignee: '',
					end_mobile: '',
					end_landline: '',
					end_province: '',
					end_city: '',
					end_district: '',
					end_address: '',
					logistics_type: ''
				};
			} else {
				info = {
					order_sn: this.orderInfo.order_sn,
					start_consignee: this.orderInfo.order_logistics.start_consignee,
					company_name: this.orderInfo.order_logistics.company_name,
					start_mobile: this.orderInfo.order_logistics.start_mobile,
					start_landline: this.orderInfo.order_logistics.start_landline,
					start_province: this.orderInfo.order_logistics.start_province,
					start_city: this.orderInfo.order_logistics.start_city,
					start_district: this.orderInfo.order_logistics.start_district,
					start_address: this.orderInfo.order_logistics.start_address,
					end_consignee: this.orderInfo.order_logistics.end_consignee,
					end_mobile: this.orderInfo.order_logistics.end_mobile,
					end_landline: this.orderInfo.order_logistics.end_landline,
					end_province: this.orderInfo.order_logistics.end_province,
					end_city: this.orderInfo.order_logistics.end_city,
					end_district: this.orderInfo.order_logistics.end_district,
					end_address: this.orderInfo.order_logistics.end_address,
					logistics_type: this.orderInfo.order_logistics.logistics_type
				};
			}
			this.$layer.iframe({
				title: '修改物流点信息',
				maxmin: true,
				area: ['60%', '60%'],
				content: {
					content: editLogistics, //传递的组件对象
					parent: this, //当前的vue对象
					data: {
						info: info
					} //props
				}
			});
		},
		selectInstall() {
			let data = {
				is_install: this.orderInfo.is_install,
				order_id: this.orderInfo.order_id,
			}

			this.$http(this.$ApiList.UpdateOrderService, data).then(res => {
				this.$layer.msg(res.datas);
			});

		},
		addAfterSale(rec_id) {
			this.$router.push({ path: "/add_after_sale", query: { rec_id } });
		},
		// 获取工厂分账打款列表
		getPlantList() {
			let data = {
				order_id: this.order_id,
				page: 0,
				limit: 100
			}
			this.$http(this.$ApiList.lists, data).then(res => {
				this.list = res.datas.data;
			})
		},
		onUpType(factory_pay_id) {
			this.$http(this.$ApiList.AdminfactorypayUp, {
				status: 2,
				factory_pay_id
			}).then(res => {
				this.$message.success(res.datas);
				this.getPlantList();
			})
		},
		// 跳到分账列表
		onOpenPage(order_id) {
			this.$router.push({ path: 'factory_sub_account', query: { order_id } })
		},
		// 打款改价
		onOpenMoney(factory_pay_id) {
			this.remitChangeDialog = true;
			this.remitForm.factory_pay_id = factory_pay_id;
		},
		// 删除图片
		onDelImg(index) {
			this.$confirm('删除后不可恢复，是否确认删除?', '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
			})
				.then(() => {
					this.orderInfo.express_img.splice(index, 1)
					let data = {
						order_id: this.order_id,
						express_img: this.orderInfo.express_img.join(',')
					}
					this.$http(this.$ApiList.DelOrderExpressImg, data).then(res => {
						this.$message.success(res.datas);
					})
				})
				.catch(() => { });
		},
		// 撤回入仓
		onRevocationWarehouse(rec_id) {
			this.$confirm('此操作将撤回入仓, 是否继续?', '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
			})
				.then(() => {
					this.$http(this.$ApiList.OrderIntoWarehouseRevoke, { rec_id }).then(res => {
						this.$message.success(res.datas);
						this.init();
					})
				})
				.catch(() => { });
		},
		handleRowClick(row) {
			this.$refs.goodsTable.toggleRowSelection(row);
		},
		// 后台备注
		onAfterRemark(row) {
			this.afterForm.rec_id = row.rec_id
			this.afterForm.order_id = this.order_id
			this.afterDialog = true
		},
		// 打印所有唛头
		onAllPrinting() {
			const { href } = this.$router.resolve({ path: '/maitou', query: { type: 'all', order_sn: this.orderInfo.order_sn } })
			window.open(href, '_blank')
		},
		// 设置商品数量
		onSetOrdefNumber(data) {
			const { goods_number, rec_id, order_id } = data
			if (goods_number !== '') {
				this.$http(this.$ApiList.OrderChangeGoodsNum, { goods_number, rec_id, order_id }).then(res => {

				})
			}
		},
		// 批量移区
		onBatchWarehouse() {
			if (this.shippingList.length == 0) {
				this.$message({
					message: '至少要选择一件商品',
					type: 'warning'
				});
				return;
			}
			let rec_id = this.shippingList.map(item => item.rec_id).join(',')
			this.onMoveWarehouse(rec_id)
		},
		// 厂家分账
		onSplitAccount() {
			this.$http(this.$ApiList.SplitAccount, { order_sn: this.orderInfo.order_sn }).then(res => {
				this.$message.success(res.datas)
			})
		},
		// 商家转账
		getUseMoneyDetailList() {
			let data = {
				order_id: this.order_id
			}
			if (this.admin_id == 2) {
				data.level = 2
			} else if (this.admin_id == 16) {
				data.level = 1
			}
			this.$http(this.$ApiList.UseMoneyDetailList, data).then(res => {
				this.useMoneyDetailList = res.datas.list
			})
		},
		// 商家确认转账
		onChangeUseMoneyDetailConfirm(user_money_detail_id) {
			this.$http(this.$ApiList.UseMoneyDetailConfirm, { user_money_detail_id }).then(res => {
				this.$message.success(res.datas)
				this.getUseMoneyDetailList()
			})
		}
	},
	created() {
		this.init();
		this.getWarehouse();
		// this.getPlantList();
	}
};
</script>
<style lang="scss">
.vl-notify {
	z-index: 3000;
}

.noStock{
	width: 620px;
}

.change-goods-dialog{
	.old-info{
		line-height: 28px;
		font-size: 12px;
		color: #000;
		font-weight: bold;
		label{
			font-weight: normal;
			color: #888;
		}
	}
	h2{
		font-size: 14px;
		font-weight: normal;
		margin-top: 12px;
		margin-bottom: 12px;
	}
	ul li{
		margin-top: 20px;
		h1{
			font-size: 16px;
			color: #000;
		}
		.input{
			display: flex;
			align-items: flex-start;
			margin-top: 12px;
			label{
				width: 100px;
				line-height: 40px;
			}
			label + *{
				flex: 1;
				min-width: 0;
			}
			.el-switch{
				margin-top: 10px;
			}
		}
	}
}

.order-details {
	.order-content .order-title {
		line-height: 30px;
		border-bottom: 1px solid #dedede;
		font-size: 16px;
		font-weight: bold;
	}

	.order-content .order-info-title {
		margin: 20px 0;
		padding-left: 6px;
		line-height: 20px;
		border-left: 4px solid #2073f5;
	}

	.order-content .order-info-content .el-col {
		line-height: 40px;
	}

	.order-content .order-info-content .logistics-img {
		display: inline-block;
		position: relative;
		width: 50px;
		height: 50px;
		margin-left: 20px;
	}

	.order-content .order-info-content .logistics-img .del {
		position: absolute;
		font-size: 20px;
		color: #ef3030;
		right: 2px;
		top: 2px;
		z-index: 1;
		background-color: #fff;
		border-radius: 50%;
		cursor: pointer;
	}

	.order-content .button-group {
		margin-top: 20px;
		display: flex;
		justify-content: center;
	}

	.order-content .button-group .el-button {
		color: #fff;
		background-color: #2073f5;
	}

	.order-content .button-group .el-button:last-child {
		color: #fff;
		background-color: #36c3b4;
	}

	/* 表格内的操作 */
	.margin-top6px {
		margin-top: 6px;
	}

	/* 表格内的操作-end */
	.cell {
		padding: 0 6px !important;
	}

	.sort-input-view {
		min-height: 23px;
	}

	.el-checkbox__inner {
		width: 20px !important;
		height: 20px !important;
	}

	.el-checkbox__inner::after {
		height: 10px !important;
		width: 8px !important;
	}
}
.upload-box {
	padding-left: 40px;

	.goods-img-upload {
		display: flex;

		.goods-img-upload-imgs {
			flex: 1;
			align-items: flex-start;

			.el-image {
				width: 140px;
				height: 140px;
				border: solid 1px #e5e5e5;
				margin-left: 25px;
				vertical-align: top;
			}
		}

		.goods-img-upload-imgs-info {
			width: 100%;
			max-width: 660px;
			border: solid 1px #e5e5e5;
			margin-left: 25px;
			min-height: 390px;

			.goods-img-upload-imgs-info-box {
				position: relative;

				.el-icon-error {
					position: absolute;
					font-size: 20px;
					color: #ef3030;
					right: 5px;
					top: 5px;
					z-index: 1;
					background-color: #fff;
					border-radius: 50%;
					cursor: pointer;
				}
			}

			.el-image {
				width: 100%;
				vertical-align: top;
			}
		}

		.vice_big_box {
			position: relative;
			display: inline-block;
			vertical-align: top;
			margin-bottom: 20px;

			.el-icon-error {
				position: absolute;
				font-size: 20px;
				color: #ef3030;
				right: 5px;
				top: 5px;
				z-index: 1;
				background-color: #fff;
				border-radius: 50%;
				cursor: pointer;
			}
		}
	}

	.el-upload__tip {
		width: 80px;
		text-align: center;
	}

	.el-form-item__label {
		float: none;
	}

	.el-form-item__content {
		margin-left: 0 !important;

		.el-button--danger {
			width: 80px;
			background-color: #37c1d6;
			border-color: #37c1d6;
		}
	}
}
</style>
